package top.tocchen.bookshop.service.impl;

import top.tocchen.bookshop.dao.CartDao;
import top.tocchen.bookshop.entity.CartEntity;
import top.tocchen.bookshop.entity.CartDoEntity;
import top.tocchen.bookshop.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tocchen
 * Date: 2021-05-12
 * Time: 22:32
 */
@Service
public class CartServiceImpl implements CartService {

    @Autowired CartDao cartDao;

    @Override
    public List<CartDoEntity> findByCartUserId(Integer uid) {
        return cartDao.findByCartUserId(uid);
    }

    @Override
    public int insert(CartEntity record){
        return cartDao.insert(record);
    }

    @Override
    public void deleteByUserID(Integer id) {
        cartDao.deleteByUserID(id);
    }

    @Override
    public void updateByIdSetCount(CartEntity cart) {
        cartDao.updateByIdSetCount(cart);
    }

    @Override
    public List<CartEntity> findAll() {
        return cartDao.findAll();
    }


}
